<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MY_Config
 *
 * @author lucas
 */
class MY_Config extends CI_Config {

    //put your code here

    private $CI = null;

    public function __construct() {
        parent::__construct();
    }

    // --------------------------------------------------------------------

    /**
     * Fetch a config file item all
     *
     *
     * @access	public
     * @return	string
     */
    function item_all() {
        return $this->config;
    }

    // --------------------------------------------------------------------

    /**
     * Site URL
     * Returns base_url . index_page [. uri_string]
     *
     * @access	public
     * @param	string	the URI string
     * @return	string
     */
    /* function site_url($uri = '') {
      return parent::site_url($this->_pre_redirect($uri));
      } */

    // -------------------------------------------------------------

    /**
     * Base URL
     * Returns base_url [. uri_string]
     *
     * @access public
     * @param string $uri
     * @return string
     */
    /* function base_url($uri = '') {
      return parent::base_url($this->_pre_redirect($uri));
      } */

    private function _pre_redirect($uri = '') {
        if (isset($_SERVER['REDIRECT_QUERY_STRING']) AND strlen($_SERVER['REDIRECT_QUERY_STRING']) > 0) {
            $u = explode('/', $_SERVER['REDIRECT_QUERY_STRING']);
            return $u[1] . '/' . $uri;
        } else {
            return $uri;
        }
    }

}
